﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DepartmentManagement.aspx.cs"
    Inherits="BEGDC.CC.Web.CIS2.Overseas.Admin.DepartmentManagement" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="../../../css/global.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/content/entity.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
    <link href="../../../css/main.css" rel="stylesheet" type="text/css" />

    <script src="../../../js/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="../../../js/jquery-ui.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(function() {
            $("input:submit,input:button").addClass("btn");

            $(".entity-delete a")
                .attr("title", "Delete")
                .bind("click", function() {
                    return confirm("Are you sure to delete this item?");
                });

            $(".entity-modify a")
                .attr("title", "Modify");
        });
    </script>

    <script language="javascript" type="text/javascript">
        $(document).ready(function() {

            /*奇数行偶数行背景色*/
            $(".tablestyle tr:even").addClass("trwhitebg");
            $(".tablestyle tr:odd").addClass("trpurplebg");
            /*列表鼠标效果*/
            $('.tbody').mouseover(function() {
                $(this).addClass('trhover');
            })
            $('.tbody').mouseout(function() {
                $(this).removeClass('trhover');
            })

        });

    </script>

    <script type="text/javascript">
        $(function() {
            //UI show
            $(".dept-name").prev().append("<span style='color: red'> *</span>");
            //submit event
            $(".dept-update").children().first().bind("click", function() {
                var result = "";
                //validation empty
                if ($(".dept-name").children().first().val() == "") {
                    result += "Department Name could not be empty!\n";
                    $(".dept-name").children().first().addClass("validation-error");
                }
                else {
                    $(".dept-name").children().first().removeClass("validation-error");
                }

                if (result != "") {
                    alert(result);
                    return false;
                }
                return true;
            });
        });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div class="mainbox">
        <div class="sitemapbox">
            <div id="info" class="sitemap">
                &nbsp;&raquo;&nbsp;Administration &nbsp;&raquo;&nbsp;Department Mgmt
            </div>
        </div>
        <table cellspacing="0" cellpadding="0">
            <tr>
                <td>
                    <!--tab区域-->
                    <div class="tabbox purplebg_dark">
                        <ul class="tabpos">
                            <li><span class="tab_active">Department Management</span></li>
                        </ul>
                    </div>
                    <div class="formbox">
                        <span class=" float_lft">
                            <div class="formbox_float_lft">
                                <asp:ResourceButton ID="Addbtn" runat="server" Text="Add" ToolTip="AddTips" CssClass="btn" />
                            </div>
                            <div class="formbox_float_rgt">
                                <asp:TextBox ID="SearchText" runat="server" CssClass="txtbox width140" onmouseover="this.className='txtboxover width140';"
                                    onMouseOut="this.className='txtbox width140';"></asp:TextBox>
                                <asp:ResourceButton ID="Searchbtn" runat="server" ToolTip="SearchTips" Text="Search"
                                    CssClass="btn" />
                                <asp:ResourceButton ID="Cleanbtn" runat="server" ToolTip="ClearTips" Text="Clear"
                                    CssClass="btn" />
                            </div>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
        <table width="100%" id="Table1" cellspacing="0" cellpadding="0" border="0">
            <tbody>
                <tr>
                    <td>
                        <asp:GridView ID="gvDepartment" runat="server" AllowPaging="True" AllowSorting="True"
                            AutoGenerateColumns="False" DataKeyNames="DepartmentID" DataSourceID="edsDepartment"
                            EmptyDataText="There is no data to display!" CssClass="tablestyle">
                            <FooterStyle />
                            <RowStyle CssClass="tbody" />
                            <PagerStyle CssClass="pagecounting2" HorizontalAlign="right" />
                            <SelectedRowStyle />
                            <HeaderStyle CssClass="thead" ForeColor="#ffffff" />
                            <Columns>
                                <asp:BoundField DataField="Name" HeaderText="Name<br/>部门名称" HtmlEncode="false" SortExpression="Name" />
                                <asp:BoundField DataField="Description" HeaderText="Description<br/>部门描述" HtmlEncode="false"
                                    SortExpression="Description" />
                                <asp:ButtonField CommandName="Modify" ButtonType="Link" ItemStyle-CssClass="entity-modify"
                                    ItemStyle-Width="20px" />
                                <asp:ButtonField CommandName="Disable" ButtonType="Link" ItemStyle-CssClass="entity-delete"
                                    ItemStyle-Width="20px" />
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:DetailsView ID="dvDepartment" runat="server" AutoGenerateRows="False" DataKeyNames="DepartmentID"
                            DataSourceID="edsDepartment" EnableModelValidation="True" Visible="False" CssClass="tablestyle2">
                            <HeaderStyle CssClass="tablestyle2_Title"></HeaderStyle>
                            <HeaderTemplate>
                                Details of the department
                            </HeaderTemplate>
                            <FieldHeaderStyle CssClass="tablestyle2_tdTitle" />
                            <Fields>
                                <asp:BoundField DataField="Name" HeaderText="Name (名称)" HtmlEncode="false" SortExpression="Name"
                                    ItemStyle-CssClass="dept-name" />
                                <asp:BoundField DataField="Description" HeaderText="Description (描述)" HtmlEncode="false"
                                    SortExpression="Description" />
                                <asp:CommandField ShowEditButton="True" ShowInsertButton="True" ButtonType="Button"
                                    ItemStyle-CssClass="dept-update" UpdateText="Update (更新)" InsertText="Insert (添加)"
                                    CancelText="Cancel (取消)" />
                            </Fields>
                        </asp:DetailsView>
                    </td>
                </tr>
                <tr>
                    <td>
                        <table>
                            <tr>
                                <td>
                                    <asp:EntityDataSource ID="edsDepartment" runat="server" ConnectionString="name=CCEntities"
                                        DefaultContainerName="CCEntities" EnableDelete="True" EnableInsert="True" EnableUpdate="True"
                                        EntitySetName="CustomerDepartments" Where="it.Disabled = false" OnInserted="edsDepartment_Inserted"
                                        OnUpdated="edsDepartment_Updated">
                                    </asp:EntityDataSource>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    </form>
     <%--页面刷新时显示--%>
    <div id="dialog-message" title="Loading..." style="display: none">
        <p>
            <br />
            <span class="entity-loading"></span><span>Operation in process, please wait...<br />
                <br />
                处理中, 请稍候。。。</span>
        </p>
    </div>

</body>
</html>
